class Sound < ActiveRecord::Base
  attr_accessible :name, :url,:rating,:userid
  validates :name,  :presence => true
  validates :url, :presence => true

  def getTrackId()
    client = Soundcloud.new :client_id => '68d071e4680a500b7f08aa2276b70c28'
    track = client.get('/resolve', :url => self.url)
    return track.id
  end

  def getRatingText()
    case self.rating
    when 0
      return "yet to be rated"
    when 3
      return "superb"
    when 2
      return "ok"
    when 1
      return "bad"
    end
  end

end
